home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / fpc / compiler / parser.pas < prev    next >
Pascal/Delphi Source File  |  1998-09-24  |  29KB  |  894 lines

  1. {
  2.     $Id: parser.pas,v 1.2.2.1 1998/08/18 13:45:33 carl Exp $
  3.     Copyright (c) 1993-98 by Florian Klaempfl
  4.  
  5.     This unit does the parsing process
  6.  
  7.     This program is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation; either version 2 of the License, or
  10.     (at your option) any later version.
  11.  
  12.     This program is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU General Public License
  18.     along with this program; if not, write to the Free Software
  19.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  ****************************************************************************
  22. }
  23. {$ifdef tp}
  24.   {$E+,N+,D+,F+}
  25. {$endif}
  26. unit parser;
  27.  
  28.   interface
  29.  
  30.     procedure compile(const filename:string;compile_system:boolean);
  31.     procedure initparser;
  32.  
  33.   implementation
  34.  
  35.     uses
  36.        dos,objects,cobjects,globals,scanner,systems,symtable,tree,aasm,
  37.        types,strings,pass_1,hcodegen,files,verbose,script,import
  38. {$ifdef i386}
  39.        ,i386
  40.        ,cgi386
  41.        ,cgai386
  42.        ,tgeni386
  43.        ,aopt386
  44. {$endif i386}
  45. {$ifdef m68k}
  46.         ,m68k
  47.         ,cg68k
  48.         ,tgen68k
  49.         ,cga68k
  50. {$endif m68k}
  51.        { parser units }
  52.        ,pbase,pmodules,pdecl,
  53.        { assembling & linking }
  54.        assemble,
  55.        link;
  56.  
  57.   { dummy variable for search when calling exec }
  58.   var
  59.      file_found : boolean;
  60.  
  61.     procedure readconstdefs;
  62.  
  63.       begin
  64.          s32bitdef:=porddef(globaldef('longint'));
  65.          u32bitdef:=porddef(globaldef('ulong'));
  66.          cstringdef:=pstringdef(globaldef('string'));
  67. {$ifdef UseLongString}
  68.          clongstringdef:=pstringdef(globaldef('longstring'));
  69. {$endif UseLongString}
  70. {$ifdef UseAnsiString}
  71.          cansistringdef:=pstringdef(globaldef('ansistring'));
  72. {$endif UseAnsiString}
  73.          cchardef:=porddef(globaldef('char'));
  74. {$ifdef i386}
  75.          c64floatdef:=pfloatdef(globaldef('s64real'));
  76. {$endif}
  77. {$ifdef m68k}
  78.          c64floatdef:=pfloatdef(globaldef('s32real'));
  79. {$endif m68k}
  80.          s80floatdef:=pfloatdef(globaldef('s80real'));
  81.          s32fixeddef:=pfloatdef(globaldef('cs32fixed'));
  82.          voiddef:=porddef(globaldef('void'));
  83.          u8bitdef:=porddef(globaldef('byte'));
  84.          u16bitdef:=porddef(globaldef('word'));
  85.          booldef:=porddef(globaldef('boolean'));
  86.          voidpointerdef:=ppointerdef(globaldef('void_pointer'));
  87.          cfiledef:=pfiledef(globaldef('file'));
  88.       end;
  89.  
  90.     procedure initparser;
  91.  
  92.       begin
  93.          forwardsallowed:=false;
  94.  
  95.          { ^M means a string or a char, because we don't parse a }
  96.          { type declaration                                      }
  97.          parse_types:=false;
  98.  
  99.          { we didn't parse a object or class declaration }
  100.          { and no function header                        }
  101.          testcurobject:=0;
  102.  
  103.          { create error defintion }
  104.          generrordef:=new(perrordef,init);
  105.  
  106.          symtablestack:=nil;
  107.  
  108.          { a long time, this was forgotten }
  109.          aktprocsym:=nil;
  110.  
  111.          current_module:=nil;
  112.  
  113.          loaded_units.init;
  114.  
  115.          usedunits.init;
  116.       end;
  117.  
  118.     { moved out to save stack }
  119.     var
  120.        addparam : string;
  121.  
  122.     procedure compile(const filename:string;compile_system:boolean);
  123.       var
  124.          hp : pmodule;
  125.          comp_unit : boolean;
  126.  
  127.          { some variables to save the compiler state }
  128.          oldtoken : ttoken;
  129.          oldpattern : stringid;
  130.  
  131.          oldpreprocstack : ppreprocstack;
  132.          oldorgpattern,oldprocprefix : string;
  133.          oldparse_types : boolean;
  134.          oldinputbuffer : pchar;
  135.          oldinputpointer : longint;
  136.          olds_point,oldparse_only : boolean;
  137.          oldc : char;
  138.          oldcomment_level : word;
  139.  
  140.          oldimports,oldexports,oldresource,
  141.          oldbsssegment,olddatasegment,oldcodesegment,
  142.          oldexprasmlist,olddebuglist,
  143.          oldinternals,oldexternals,oldconsts : paasmoutput;
  144.  
  145.  
  146.          oldnextlabelnr : longint;
  147.  
  148.          oldswitches : Tcswitches;
  149.          oldmacros,oldrefsymtable,oldsymtablestack : psymtable;
  150.  
  151.  
  152.       procedure def_macro(const s : string);
  153.  
  154.         var
  155.           mac : pmacrosym;
  156.  
  157.         begin
  158.            mac:=pmacrosym(macros^.search(s));
  159.            if mac=nil then
  160.              begin
  161.                mac:=new(pmacrosym,init(s));
  162.                Message1(parser_m_macro_defined,mac^.name);
  163.                macros^.insert(mac);
  164.              end;
  165.            mac^.defined:=true;
  166.         end;
  167.  
  168.       procedure set_macro(const s : string;value : string);
  169.  
  170.         var
  171.           mac : pmacrosym;
  172.  
  173.         begin
  174.            mac:=pmacrosym(macros^.search(s));
  175.            if mac=nil then
  176.              begin
  177.                mac:=new(pmacrosym,init(s));
  178.                macros^.insert(mac);
  179.              end
  180.            else
  181.              begin
  182.                 if assigned(mac^.buftext) then
  183.                   freemem(mac^.buftext,mac^.buflen);
  184.              end;
  185.            Message2(parser_m_macro_set_to,mac^.name,value);
  186.            mac^.buflen:=length(value);
  187.            getmem(mac^.buftext,mac^.buflen);
  188.            move(value[1],mac^.buftext^,mac^.buflen);
  189.            mac^.defined:=true;
  190.         end;
  191.  
  192.       procedure define_macros;
  193.  
  194.         var
  195.            hp : pstring_item;
  196.  
  197.         begin
  198.            hp:=pstring_item(commandlinedefines.first);
  199.            while assigned(hp) do
  200.              begin
  201.                def_macro(hp^.str^);
  202.                hp:=pstring_item(hp^.next);
  203.              end;
  204.  
  205.            { set macros for version checking }
  206.            set_macro('FPC_VERSION',version_nr);
  207.            set_macro('FPC_RELEASE',release_nr);
  208.            set_macro('FPC_PATCH',patch_nr);
  209.         end;
  210.  
  211.       var
  212.          a : PAsmFile;
  213.          g : file;
  214.          ftime : longint;
  215.       label
  216.          done;
  217.  
  218.       begin {compile}
  219.          inc(compile_level);
  220.          { save old state }
  221.  
  222.          { save symtable state }
  223.          oldsymtablestack:=symtablestack;
  224.          symtablestack:=nil;
  225.          oldrefsymtable:=refsymtable;
  226.          refsymtable:=nil;
  227.          oldprocprefix:=procprefix;
  228.  
  229.          { a long time, this was only in init_parser
  230.            but it should be reset to zero for each module }
  231.          aktprocsym:=nil;
  232.  
  233.          { first, we assume a program }
  234.          if not(assigned(current_module)) then
  235.            begin
  236. {!!!}
  237.               current_module:=new(pmodule,init(filename,false));
  238.               main_module:=current_module;
  239.            end;
  240.          { reset flags }
  241.          current_module^.flags:=0;
  242.          { ... and crc }
  243.          current_module^.crc:=0;
  244.  
  245.          { save scanner state }
  246.          oldmacros:=macros;
  247.          oldpattern:=pattern;
  248.          oldtoken:=token;
  249.          oldorgpattern:=orgpattern;
  250.          oldparse_types:=parse_types;
  251.          oldpreprocstack:=preprocstack;
  252.  
  253.          oldinputbuffer:=inputbuffer;
  254.          oldinputpointer:=inputpointer;
  255.          olds_point:=s_point;
  256.          oldc:=c;
  257.          oldcomment_level:=comment_level;
  258.  
  259.          oldparse_only:=parse_only;
  260.  
  261.          { save assembler lists }
  262.          olddatasegment:=datasegment;
  263.          oldbsssegment:=bsssegment;
  264.          oldcodesegment:=codesegment;
  265.          olddebuglist:=debuglist;
  266.          oldexternals:=externals;
  267.          oldinternals:=internals;
  268.          oldconsts:=consts;
  269.          oldexprasmlist:=exprasmlist;
  270.          oldimports:=importssection;
  271.          oldexports:=exportssection;
  272.          oldresource:=resourcesection;
  273.  
  274.          oldswitches:=aktswitches;
  275.          oldnextlabelnr:=nextlabelnr;
  276.  
  277.          Message1(parser_i_compiling,filename);
  278.  
  279.          InitScanner(filename);
  280.  
  281.          aktswitches:=initswitches;
  282.  
  283.          { we need this to make the system unit }
  284.          if compile_system then
  285.           aktswitches:=aktswitches+[cs_compilesystem];
  286.  
  287.          aktpackrecords:=initpackrecords;
  288.  
  289.          { init code generator for a new module }
  290.          codegen_newmodule;
  291.          macros:=new(psymtable,init(macrosymtable));
  292.  
  293.          define_macros;
  294.  
  295.          { startup scanner }
  296.          token:=yylex;
  297.  
  298.          { init asm writing }
  299.          datasegment:=new(paasmoutput,init);
  300.          codesegment:=new(paasmoutput,init);
  301.          bsssegment:=new(paasmoutput,init);
  302.          debuglist:=new(paasmoutput,init);
  303.          externals:=new(paasmoutput,init);
  304.          internals:=new(paasmoutput,init);
  305.          consts:=new(paasmoutput,init);
  306.          importssection:=nil;
  307.          exportssection:=nil;
  308.          resourcesection:=nil;
  309.  
  310.          { global switches are read, so further changes aren't allowed }
  311.          current_module^.in_main:=true;
  312.  
  313.          { open assembler response }
  314.          if (compile_level=1) then
  315.           AsmRes.Init('ppas');
  316.  
  317.          { if the current file isn't a system unit  }
  318.          { the the system unit will be loaded       }
  319.          if not(cs_compilesystem in aktswitches) then
  320.            begin
  321.               { should be done in unit system (changing the field system_unit)
  322.                                                                       FK
  323.               }
  324.               hp:=loadunit(upper(target_info.system_unit),true,true);
  325.               systemunit:=hp^.symtable;
  326.               readconstdefs;
  327.               { we could try to overload caret by default }
  328.               symtablestack:=systemunit;
  329.               { if POWER is defined in the RTL then use it for caret overloading }
  330.               getsym('POWER',false);
  331.               if assigned(srsym) and (srsym^.typ=procsym) and
  332.                  (overloaded_operators[CARET]=nil) then
  333.                 overloaded_operators[CARET]:=pprocsym(srsym);
  334.            end
  335.          else
  336.            begin
  337.               { create definitions for constants }
  338.               registerdef:=false;
  339.               s32bitdef:=new(porddef,init(s32bit,$80000000,$7fffffff));
  340.               u32bitdef:=new(porddef,init(u32bit,0,$ffffffff));
  341.               cstringdef:=new(pstringdef,init(255));
  342.               { should we give a length to the default long and ansi string definition ?? }
  343. {$ifdef UseLongString}
  344.               clongstringdef:=new(pstringdef,longinit(-1));
  345. {$endif UseLongString}
  346. {$ifdef UseAnsiString}
  347.               cansistringdef:=new(pstringdef,ansiinit(-1));
  348. {$endif UseAnsiString}
  349.               cchardef:=new(porddef,init(uchar,0,255));
  350. {$ifdef i386}
  351.               c64floatdef:=new(pfloatdef,init(s64real));
  352.               s80floatdef:=new(pfloatdef,init(s80real));
  353. {$endif}
  354. {$ifdef m68k}
  355.               c64floatdef:=new(pfloatdef,init(s32real));
  356.               if (cs_fp_emulation in aktswitches) then
  357.                s80floatdef:=new(pfloatdef,init(s32real))
  358.               else
  359.                s80floatdef:=new(pfloatdef,init(s80real));
  360. {$endif}
  361.               s32fixeddef:=new(pfloatdef,init(f32bit));
  362.  
  363.               { some other definitions }
  364.               voiddef:=new(porddef,init(uvoid,0,0));
  365.               u8bitdef:=new(porddef,init(u8bit,0,255));
  366.               u16bitdef:=new(porddef,init(u16bit,0,65535));
  367.               booldef:=new(porddef,init(bool8bit,0,1));
  368.               voidpointerdef:=new(ppointerdef,init(voiddef));
  369.               cfiledef:=new(pfiledef,init(ft_untyped,nil));
  370.               systemunit:=nil;
  371.            end;
  372.          registerdef:=true;
  373.  
  374.          { current return type is void }
  375.          procinfo.retdef:=voiddef;
  376.  
  377.          { reset lexical level }
  378.          lexlevel:=0;
  379.  
  380.          { parse source }
  381. {***BUGFIX}
  382.          if (token=_UNIT) or (compile_level>1) then
  383.             begin
  384.                 {If the compile level > 1 we get a nice "unit expected" error
  385.                  message if we are trying to use a program as unit.}
  386.                 proc_unit;
  387.                 if current_module^.compiled then
  388.                     goto done;
  389.                 comp_unit:=true;
  390.             end
  391.          else
  392.            begin
  393.               proc_program(token=_LIBRARY);
  394.               comp_unit:=false;
  395.            end;
  396.  
  397.          { Why? The definition of Pascal requires that everything
  398.            after 'end.' is ignored!
  399.          if not(cs_tp_compatible in aktswitches) then
  400.             consume(_EOF); }
  401.  
  402.          if errorcount=0 then
  403.            begin
  404.              if current_module^.uses_imports then
  405.               importlib^.generatelib;
  406.  
  407.              a:=new(PAsmFile,Init(filename));
  408.              a^.WriteAsmSource;
  409.              a^.DoAssemble;
  410.              dispose(a,Done);
  411.  
  412.              { Check linking  => we are at first level in compile }
  413.              if (compile_level=1) then
  414.               begin
  415.             if Linker.ExeName='' then
  416.                  Linker.SetFileName(FileName);
  417.                 if (comp_unit) then
  418.                  begin
  419.                    Linker.Make_Library;
  420.                  end
  421.                 else
  422.                  begin
  423.                    if (cs_no_linking in initswitches) then
  424.                     externlink:=true;
  425.                    Linker.Link;
  426.                  end;
  427.               end;
  428.            end
  429.          else
  430.            begin
  431.               Message1(unit_e_total_errors,tostr(errorcount));
  432.               Message(unit_f_errors_in_unit);
  433.            end;
  434.          { clear memory }
  435. {$ifdef Splitheap}
  436.          if testsplit then
  437.            begin
  438.            { temp heap should be empty after that !!!}
  439.            codegen_donemodule;
  440.            Releasetempheap;
  441.            end;
  442.          {else
  443.            codegen_donemodule;}
  444. {$endif Splitheap}
  445.          { restore old state }
  446.          { if already compiled jumps directly here }
  447. done:
  448.          { close trees }
  449.  
  450.          if dispose_asm_lists then
  451.          Begin
  452.             dispose(datasegment,Done);
  453.             dispose(codesegment,Done);
  454.             dispose(bsssegment,Done);
  455.             dispose(debuglist,Done);
  456.             dispose(externals,Done);
  457.             dispose(internals,Done);
  458.             dispose(consts,Done);
  459.          end;
  460.  
  461.          { restore symtable state }
  462. {$ifdef UseBrowser}
  463.          if (compile_level>1) then
  464. { we want to keep the current symtablestack }
  465. {$endif UseBrowser}
  466.            begin
  467.               refsymtable:=oldrefsymtable;
  468.               symtablestack:=oldsymtablestack;
  469.            end;
  470.  
  471.          procprefix:=oldprocprefix;
  472.  
  473.          { close the inputfiles }
  474. {$ifndef UseBrowser}
  475.          { but not if we want the names for the browser ! }
  476.          current_module^.sourcefiles.done;
  477. {$endif not UseBrowser}
  478.          { restore scanner state }
  479.          pattern:=oldpattern;
  480.          token:=oldtoken;
  481.          orgpattern:=oldorgpattern;
  482.          parse_types:=oldparse_types;
  483.  
  484.          { call donescanner before restoring preprocstack, because }
  485.          { donescanner tests for a empty preprocstack              }
  486.          { and can also check for unused macros                    }
  487.          donescanner(current_module^.compiled);
  488.          dispose(macros,done);
  489.          macros:=oldmacros;
  490.  
  491.  
  492.          preprocstack:=oldpreprocstack;
  493.  
  494.          aktswitches:=oldswitches;
  495.          inputbuffer:=oldinputbuffer;
  496.          inputpointer:=oldinputpointer;
  497.          s_point:=olds_point;
  498.          c:=oldc;
  499.          comment_level:=oldcomment_level;
  500.  
  501.          parse_only:=oldparse_only;
  502.  
  503.          { restore asmlists }
  504.          datasegment:=olddatasegment;
  505.          bsssegment:=oldbsssegment;
  506.          codesegment:=oldcodesegment;
  507.          debuglist:=olddebuglist;
  508.          externals:=oldexternals;
  509.          internals:=oldinternals;
  510.          importssection:=oldimports;
  511.          exportssection:=oldexports;
  512.          resourcesection:=oldresource;
  513.  
  514.          nextlabelnr:=oldnextlabelnr;
  515.          exprasmlist:=oldexprasmlist;
  516.          consts:=oldconsts;
  517.  
  518.          nextlabelnr:=oldnextlabelnr;
  519.  
  520.          reset_gdb_info;
  521.          if (compile_level=1) then
  522.           begin
  523.             if (not AsmRes.Empty) then
  524.              begin
  525.                Message1(exec_i_closing_script,AsmRes.Fn);
  526.                AsmRes.WriteToDisk;
  527.              end;
  528.           end;
  529.          dec(compile_level);
  530.       end;
  531.  
  532. end.
  533. {
  534.   $Log: parser.pas,v $
  535.   Revision 1.2.2.1  1998/08/18 13:45:33  carl
  536.     + -Sd switch implemented
  537.  
  538.   Revision 1.2  1998/03/26 11:18:30  florian
  539.     - switch -Sa removed
  540.     - support of a:=b:=0 removed
  541.  
  542.   Revision 1.1.1.1  1998/03/25 11:18:12  root
  543.   * Restored version
  544.  
  545.   Revision 1.60  1998/03/24 21:48:32  florian
  546.     * just a couple of fixes applied:
  547.          - problem with fixed16 solved
  548.          - internalerror 10005 problem fixed
  549.          - patch for assembler reading
  550.          - small optimizer fix
  551.          - mem is now supported
  552.  
  553.   Revision 1.59  1998/03/20 23:31:33  florian
  554.     * bug0113 fixed
  555.     * problem with interdepened units fixed ("options.pas problem")
  556.     * two small extensions for future AMD 3D support
  557.  
  558.   Revision 1.58  1998/03/13 22:45:58  florian
  559.     * small bug fixes applied
  560.  
  561.   Revision 1.57  1998/03/10 17:19:29  peter
  562.     * fixed bug0108
  563.     * better linebreak scanning (concentrated in nextchar(), it supports
  564.       #10, #13, #10#13, #13#10
  565.  
  566.   Revision 1.56  1998/03/10 16:27:40  pierre
  567.     * better line info in stabs debug
  568.     * symtabletype and lexlevel separated into two fields of tsymtable
  569.     + ifdef MAKELIB for direct library output, not complete
  570.     + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
  571.       working
  572.     + ifdef TESTFUNCRET for setting func result in underfunction, not
  573.       working
  574.  
  575.   Revision 1.55  1998/03/10 12:54:06  peter
  576.     * def_symbol renamed to def_macro and use it in defines_macros
  577.  
  578.   Revision 1.54  1998/03/10 01:17:22  peter
  579.     * all files have the same header
  580.     * messages are fully implemented, EXTDEBUG uses Comment()
  581.     + AG... files for the Assembler generation
  582.  
  583.   Revision 1.53  1998/03/06 00:52:34  peter
  584.     * replaced all old messages from errore.msg, only ExtDebug and some
  585.       Comment() calls are left
  586.     * fixed options.pas
  587.  
  588.   Revision 1.52  1998/03/02 16:00:37  peter
  589.     * -Ch works again
  590.  
  591.   Revision 1.51  1998/03/02 13:38:44  peter
  592.     + importlib object
  593.     * doesn't crash on a systemunit anymore
  594.     * updated makefile and depend
  595.  
  596.   Revision 1.49  1998/02/28 00:20:31  florian
  597.     * more changes to get import libs for Win32 working
  598.  
  599.   Revision 1.48  1998/02/27 22:27:56  florian
  600.     + win_targ unit
  601.     + support of sections
  602.     + new asmlists: sections, exports and resource
  603.  
  604.   Revision 1.47  1998/02/24 10:29:17  peter
  605.     * -a works again
  606.  
  607.   Revision 1.46  1998/02/24 00:19:14  peter
  608.     * makefile works again (btw. linux does like any char after a \ )
  609.     * removed circular unit with assemble and files
  610.     * fixed a sigsegv in pexpr
  611.     * pmodule init unit/program is the almost the same, merged them
  612.  
  613.   Revision 1.45  1998/02/22 23:03:25  peter
  614.     * renamed msource->mainsource and name->unitname
  615.     * optimized filename handling, filename is not seperate anymore with
  616.       path+name+ext, this saves stackspace and a lot of fsplit()'s
  617.     * recompiling of some units in libraries fixed
  618.     * shared libraries are working again
  619.     + $LINKLIB <lib> to support automatic linking to libraries
  620.     + libraries are saved/read from the ppufile, also allows more libraries
  621.       per ppufile
  622.  
  623.   Revision 1.44  1998/02/19 00:11:04  peter
  624.     * fixed -g to work again
  625.     * fixed some typos with the scriptobject
  626.  
  627.   Revision 1.43  1998/02/18 13:48:12  michael
  628.   + Implemented an OS independent AsmRes object.
  629.  
  630.   Revision 1.42  1998/02/17 21:20:54  peter
  631.     + Script unit
  632.     + __EXIT is called again to exit a program
  633.     - target_info.link/assembler calls
  634.     * linking works again for dos
  635.     * optimized a few filehandling functions
  636.     * fixed stabs generation for procedures
  637.  
  638.   Revision 1.41  1998/02/16 12:51:35  michael
  639.   + Implemented linker object
  640.  
  641.   Revision 1.40  1998/02/15 21:16:25  peter
  642.     * all assembler outputs supported by assemblerobject
  643.     * cleanup with assembleroutputs, better .ascii generation
  644.     * help_constructor/destructor are now added to the externals
  645.     - generation of asmresponse is not outputformat depended
  646.  
  647.   Revision 1.39  1998/02/14 01:45:26  peter
  648.     * more fixes
  649.     - pmode target is removed
  650.     - search_as_ld is removed, this is done in the link.pas/assemble.pas
  651.     + findexe() to search for an executable (linker,assembler,binder)
  652.  
  653.   Revision 1.38  1998/02/13 22:26:33  peter
  654.     * fixed a few SigSegv's
  655.     * INIT$$ was not written for linux!
  656.     * assembling and linking works again for linux and dos
  657.     + assembler object, only attasmi3 supported yet
  658.     * restore pp.pas with AddPath etc.
  659.  
  660.   Revision 1.37  1998/02/13 10:35:17  daniel
  661.   * Made Motorola version compilable.
  662.   * Fixed optimizer
  663.  
  664.   Revision 1.36  1998/02/12 17:19:12  florian
  665.     * fixed to get remake3 work, but needs additional fixes (output, I don't like
  666.       also that aktswitches isn't a pointer)
  667.  
  668.   Revision 1.35  1998/02/12 11:50:16  daniel
  669.   Yes! Finally! After three retries, my patch!
  670.  
  671.   Changes:
  672.  
  673.   Complete rewrite of psub.pas.
  674.   Added support for DLL's.
  675.   Compiler requires less memory.
  676.   Platform units for each platform.
  677.  
  678.   Revision 1.34  1998/02/02 11:47:36  pierre
  679.     + compilation stops at unit with error
  680.  
  681.   Revision 1.33  1998/02/01 22:41:08  florian
  682.     * clean up
  683.     + system.assigned([class])
  684.     + system.assigned([class of xxxx])
  685.     * first fixes of as and is-operator
  686.  
  687.   Revision 1.32  1998/01/30 17:31:23  pierre
  688.     * bug of cyclic symtablestack fixed
  689.  
  690.   Revision 1.31  1998/01/29 12:13:21  michael
  691.   * fixed Typos for library making
  692.  
  693.   Revision 1.30  1998/01/28 13:48:45  michael
  694.   + Initial implementation for making libs from within FPC. Not tested, as compiler does not run
  695.  
  696.   Revision 1.29  1998/01/25 18:45:47  peter
  697.     + Search for as and ld at startup
  698.     + source_info works the same as target_info
  699.     + externlink allows only external linking
  700.  
  701.   Revision 1.28  1998/01/23 21:14:59  carl
  702.     * RunError 105 (file not open) with -Agas switch fix
  703.  
  704.   Revision 1.27  1998/01/23 17:55:11  michael
  705.   + Moved linking stage to it's own unit (link.pas)
  706.     Incorporated Pierres changes, but removed -E switch
  707.     switch for not linking is now -Cn instead of -E
  708.  
  709.   Revision 1.26  1998/01/23 17:12:15  pierre
  710.     * added some improvements for as and ld :
  711.       - doserror and dosexitcode treated separately
  712.       - PATH searched if doserror=2
  713.     + start of long and ansi string (far from complete)
  714.       in conditionnal UseLongString and UseAnsiString
  715.     * options.pas cleaned (some variables shifted to globals)gl
  716.  
  717.   Revision 1.25  1998/01/22 14:47:16  michael
  718.   + Reinstated linker options as -k option. How did they dissapear ?
  719.  
  720.   Revision 1.24  1998/01/17 01:57:36  michael
  721.   + Start of shared library support. First working version.
  722.  
  723.   Revision 1.23  1998/01/16 22:34:37  michael
  724.   * Changed 'conversation' to 'conversion'. Waayyy too much chatting going on
  725.     in this compiler :)
  726.  
  727.   Revision 1.22  1998/01/14 12:52:04  michael
  728.   - Removed the 'Assembled' line and replaced 'Calling Linker/assembler...'
  729.     with 'Assembling/linking...'. Too much verbosity when V_info is on.
  730.  
  731.   Revision 1.21  1998/01/13 16:15:56  pierre
  732.     *  bug in interdependent units handling
  733.        - primary unit was not in loaded_units list
  734.        - current_module^.symtable was assigned too early
  735.        - donescanner must not call error if the compilation
  736.        of the unit was done at a higher level.
  737.  
  738.   Revision 1.20  1998/01/11 10:54:22  florian
  739.     + generic library support
  740.  
  741.   Revision 1.19  1998/01/11 04:17:11  carl
  742.   + correct heap and memory variables for m68k targets
  743.  
  744.   Revision 1.18  1998/01/08 23:56:39  florian
  745.     * parser unit divided into several smaller units
  746.  
  747.   Revision 1.17  1998/01/08 17:10:12  florian
  748.     * the name of the initialization part of a unit was sometimes written
  749.       in lower case
  750.  
  751.   Revision 1.16  1998/01/07 00:16:56  michael
  752.   Restored released version (plus fixes) as current
  753.  
  754.   Revision 1.13  1997/12/14 22:43:21  florian
  755.     + command line switch -Xs for DOS (passes -s to the linker to strip symbols from
  756.       executable)
  757.     * some changes of Carl-Eric implemented
  758.  
  759.   Revision 1.12  1997/12/12 13:28:31  florian
  760.   + version 0.99.0
  761.   * all WASM options changed into MASM
  762.   + -O2 for Pentium II optimizations
  763.  
  764.   Revision 1.11  1997/12/10 23:07:21  florian
  765.   * bugs fixed: 12,38 (also m68k),39,40,41
  766.   + warning if a system unit is without -Us compiled
  767.   + warning if a method is virtual and private (was an error)
  768.   * some indentions changed
  769.   + factor does a better error recovering (omit some crashes)
  770.   + problem with @type(x) removed (crashed the compiler)
  771.  
  772.   Revision 1.10  1997/12/09 13:50:36  carl
  773.   * bugfix of possible alignment problems with m68k
  774.   * bugfix of circular unit use -- could still give a stack overflow,
  775.     so changed to fatalerror instead.
  776.   * bugfix of nil procedural variables, fpc = @nil is illogical!
  777.     (if was reversed!)
  778.  
  779.   Revision 1.9  1997/12/08 13:31:31  daniel
  780.   * File was in DOS format. Translated to Unix.
  781.  
  782.   Revision 1.8  1997/12/08 10:01:08  pierre
  783.     * nil for a procvar const was not allowed (os2_targ.pas not compilable)
  784.     * bug in loadunit for units in implementation part already loaded
  785.       (crashed on dos_targ.pas, thanks to Daniel who permitted me
  786.       to find this bug out)
  787.  
  788.   Revision 1.7  1997/12/04 17:47:50  carl
  789.    + renamed m68k units and refs to these units according to cpu rules.
  790.  
  791.   Revision 1.6  1997/12/02 15:56:13  carl
  792.   * bugfix of postfixoperator with pd =nil
  793.   * bugfix of motorola instructions types for exit code.
  794.  
  795.   Revision 1.5  1997/12/01 18:14:33  pierre
  796.       * fixes a bug in nasm output due to my previous changes
  797.  
  798.   Revision 1.3  1997/11/28 18:14:40  pierre
  799.    working version with several bug fixes
  800.  
  801.   Revision 1.2  1997/11/27 17:59:46  carl
  802.   * made it compile under BP (line too long errors)
  803.  
  804.   Revision 1.1.1.1  1997/11/27 08:32:57  michael
  805.   FPC Compiler CVS start
  806.  
  807.  
  808.   Pre-CVS log:
  809.  
  810.   CEC   Carl-Eric Codere
  811.   FK    Florian Klaempfl
  812.   PM    Pierre Muller
  813.   +     feature added
  814.   -     removed
  815.   *     bug fixed or changed
  816.  
  817.  
  818.  
  819.   History (started with version 0.9.0):
  820.        5th november 1996:
  821.          * adapted to 0.9.0
  822.       25th november 1996:
  823.          * more stuff adapted
  824.        9th december 1996:
  825.          + support for different inline assemblers added (FK)
  826.       22th september:
  827.          + support for PACKED RECORD implemented (FK)
  828.       24th september:
  829.          + internal support of system.seg added (FK)
  830.          * system.ofs bug fixed (FK)
  831.          * problem with compiler switches solved (see also pass_1.pas) (FK)
  832.          * all aktswitch memory is now recoverd (see also scanner.pas) (FK)
  833.       24th september 1997:
  834.          * bug in ESI offset, pushed only if not nested, changed in cgi386.pas in v93 by (FK)
  835.            but forgotten here (PM)
  836.       25th september:
  837.          + parsing of open arrays implemented (FK)
  838.          + parsing of high and low implemented (FK)
  839.          + open array support also for proc vars added (FK)
  840.       1th october:
  841.          * in typed constants is now the conversion int -> real
  842.            automatically done (FK)
  843.       3rd october 1997:
  844.          + started conversion to motorola 68000 - ifdef m68k to find
  845.            changes (this makes the code look horrible, may later separate
  846.            in includes?) - look for all ifdef i386 and ifdef m68k to see
  847.            changes. (CEC)
  848.          - commented out regnames (was unused) (CEC)
  849.          + peepholeopt put in i386 define (not yet available for motorola
  850.             68000) (CEC)
  851.          + i386 defines around a_att, in a_o and around a_wasm, a_nasm (CEC).
  852.          + code for in_ord_x (PM)
  853.       4th october 1997:
  854.          + checking for double definitions of function/procedure
  855.            with same parameters in interface (PM)
  856.          + enums with jumps set the boolean has_jumps and
  857.            disable the succ and pred use (PM)
  858.        9th october 1997:
  859.          * Fixed problem with 80float on the 68000 output, caused a GPF (CEC).
  860.       13th october 1997:
  861.          + Added support for Motorola Standard assembler. (CEC)
  862.        15th october 1997:
  863.          + added code for static modifier for objects variables and methods
  864.            controlled by -St switch at command line (PM)
  865.       17th october 1997:
  866.         + Added support for Motorola inline assembler (CEC)
  867.         * Bugfix with .align 4,0x90, this is NOT allowed in TASM/MASM/WASM (CEC).
  868.         + procedure set_macro and setting of fpc_* macros (FK)
  869.       19th october 1997:
  870.         * Bugfix of RTS on 68000 target. PC Counter would become corrupt
  871.           with paramsize (CEC).
  872.       23th october 1997:
  873.         * Small bugfixes concerning SUBI #const,address_reg (CEC).
  874.       24th october 1997:
  875.         * array[boolean] works now (FK)
  876.       25th october 1997:
  877.         + CDECL and STDCALL (FK)
  878.         * ASSEMBLER isn't a keyword anymore (FK)
  879.        3rd november 1997:
  880.          + added symdif for sets (PM)
  881.        5th november 1997:
  882.          * changed all while token<>ATOKEN do consume(token);
  883.            by a procedure call consume_all_untill(ATOKEN)
  884.            to test for _EOF (PM)
  885.          * aktobjectname was not reset to '' at the end of objectcomponenten (PM)
  886.        14th november 1997:
  887.          * removed bug for procvar where the type was not allways set correctly (PM)
  888.          + integer const not in longint range converted to real constant (PM)
  889.        25th november 1997:
  890.          * removed bugs due to wrong current_module references in compile procedure (PM)
  891.  
  892. }
  893.  
  894.